<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DOMContent</title>
    <script>
        document.addEventListener('DOMContentLoaded',function () {
            var div = document.getElementsByTagName("div")[0];
            console.log("div");
        },false);
    //    如果想把代码写在这里请用这个  用window.onload 效率低，太慢了。但是最后把script标签写在body下面
    </script>
</head>
<body>
    <div style="width: 100px;height: 100px;background-color: red"></div>
</body>
</html>
